Add train_deviance_path_ to GeneralizedLinearRegressorCV#982
Merged
Matthias Schmidtblaicher (MatthiasSchmidtblaicherQC) merged 14 commits intomainfrom Mar 23, 2026
Merged
Add train_deviance_path_ to GeneralizedLinearRegressorCV#982Matthias Schmidtblaicher (MatthiasSchmidtblaicherQC) merged 14 commits intomainfrom
train_deviance_path_ to GeneralizedLinearRegressorCV#982Matthias Schmidtblaicher (MatthiasSchmidtblaicherQC) merged 14 commits intomainfrom
Conversation
Expose training-set deviance alongside validation deviance so users can diagnose over-/under-fitting as regularization changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bcc474a to
4ab88d2
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends GeneralizedLinearRegressorCV to expose training-set deviance values along the CV regularization path, enabling direct comparison between training and validation performance across folds, l1_ratios, and alphas.
Changes:
- Add
train_deviance_path_computed within the existing CV loop inGeneralizedLinearRegressorCV. - Add a new test validating the presence and shape of
train_deviance_path_. - Add a
CHANGELOG.rstentry documenting the new attribute.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/glum/_glm_cv.py |
Computes and stores train_deviance_path_ alongside existing deviance_path_ and updates attribute docs. |
tests/glm/test_glm_cv.py |
Extends solver-equivalence assertions and adds a new test for train_deviance_path_. |
CHANGELOG.rst |
Documents the new train_deviance_path_ feature for the next release. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Matthias Schmidtblaicher (MatthiasSchmidtblaicherQC)
and others
added 2 commits
March 10, 2026 18:05
Compare overall means instead of per-alpha to avoid failures from unlucky CV splits or high-regularization alphas. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Marc-Antoine Schmidt (MarcAntoineSchmidtQC)
approved these changes
Mar 23, 2026
8355b8e
into
main
25 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses last point on #933 .
GeneralizedLinearRegressorCVnow exposestrain_deviance_path_alongside the existingdeviance_path_(validation deviance). This makes it easy to compare training and validation performance across the regularization path.train_deviance_path_with shape(n_folds, n_l1_ratios, n_alphas),matching deviance_path_.x_trainbefore standardization so train deviance is evaluated on the original scale.Checklist
CHANGELOG.rstentry